"Select All" error in ssrs
Good Day,
i am trying to create new parameter, name of the parameter is @Month, it is throwing an error, the error is
"Must declare scalar variable @Month",
My query is,
SELECT [Count]
,[Total]
,[Block]
,[Avg]
,[Month]
,[Category]
,[FBE_Cat]
,[Amount]
,[BlockDesc]
,[AVG_amount]
FROM [IBT].[dbo].[AvgConsumptionPerBlock]
where Month=@Month
And, i did create new Dataset for the Parameter,
the query is,
SELECT DISTINCT Month
FROM AvgConsumptionPerBlock
ORDER BY Month
I did select "Multivalue"property as well, but it is still throwing an error, kindly provide suitable solution.
Thanks
May 5th, 2011 3:11am
In what query editor are you writing the query? This sounds like an error I'd expect to see in SQL Server Management Studio rather than the report designer query editor. Assuming that you are using the SSRS query editor in text view, I have a
couple of thoughts. First of all, where is the error reported? In the query editor, the report preview or after deploying the report?
When you execute the query in th editor, are you prompted to enter the @Month parameter value?
After you try to execute the query the first time, is the parameter added to the report and the dataset? Check the Parameters page on the Dataset dialog.
A remote possibility is that the editor is having trouble with the column & parameter name 'Month' because this is a reserved word. This is also the name of a T-SQL function and it's not considered to be a best practice to use reserved words as
object names. Try putting square brackets around the column name in the query. You can also try to use a different parameter name. LIke I said, this is a remote possibility an shouldn't cause problems.
What version of Repoering Services are you using?Paul Turley, MVP, www.SQLServerBIBlog.com *Please vote if helpful*
Free Windows Admin Tool Kit Click here and download it now
May 5th, 2011 4:06am
Hello,
Thanks for your reply.
When i execute the query in Query builder it is working, and when i preview the report it is throwing an error.
Thanks
May 5th, 2011 4:20am
Hi RP,
I also noticed this error during a report development and strangely it happens only with Datetime parameters. Searching google did not give me enough information on this. I tried many things and somehow when i put the parameter within parenthesis, it worked,
like (@Month). This cannot be a solution but try it as a work around :-)MSBI Developer
Free Windows Admin Tool Kit Click here and download it now
May 5th, 2011 4:31am
It's a multivalue parameter, Use 'IN' in place of '=' in your main query
Where Month IN (@Month)
Thanks
-Hardik
________________________________________________________
Please
remember to mark the replies as answers if they help..
May 5th, 2011 7:04pm